package com.atguigu.boot.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * @ClassName User
 * @Description 此类描述:
 * @Author dangchen
 * @DateTime 2022-09-28 10:19
 * @Version 1.0
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {
    //类中的id在表中是主键,通过type属性指定了主键生成策略,
    //@TableId(type = IdType.ASSIGN_ID)//默认赋值,雪花算法生成19位Long类型的值
    //@TableId(type = IdType.ASSIGN_UUID)//主键类型为String，对应MySQL字段为VARCHAR（32）
    //@TableId(type = IdType.AUTO)//数据库ID自增
    //@TableId(type = IdType.INPUT)//插入前自行设置主键值
    private Long id;
    private String name;
    private Integer age;
    private String email;

    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    @Version
    @TableField(fill = FieldFill.INSERT)//添加数据时指定默认值
    private Integer version;

    @TableLogic
    private Integer deleted;
}
